package cc3002;

/**
 * Main class Food, can be used as well, but the idea is to use the extended classes.
 * @author Anibal Llanos Prado
 */
public class Food {
	protected String name;
	protected int calories;
	protected int remainingBites;
	
	/**
     * Old Food constructor. It still works. It's the only way you can choose
     * the name and calories of the Food Object.
     * @param name The name our Food will have.
     * @param calories The amount of calories of the Food.
     */
	@Deprecated
	public Food(String name, int calories){
		this.name=name;
		this.calories=calories;
		this.remainingBites=1;
	}
	
	/**
     * Default constructor. As it has no parameters, the name is "Food" it's calories
     * are "300" by default.
     */
	public Food(){
		this.setName("Food");
		this.setCalories(300);
		this.remainingBites=1;
	}
	
	/**
     * Bites the Food to get it calories. You can only bite once each Food.
     * @return The calories that you'll get with the "bite"
     */
	public int bite(HealthState health){
		assert remainingBites!=0:"Nothing to eat";
		if(remainingBites==0)return 0;
		--remainingBites;
		return calories;
	}
	
	/**
     * Sets the name of a Food.
     * @param name The name the Food will have.
     */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * Gets the name of the Food plus the remaining bites it has.
	 * @return Food's name + the remaining bites.
	 */
	public String getFullName() {
		return name+"("+remainingBites+" bites remaining)";
	}
	
	/**
	 * Gets the name of the Food
	 * @return Food's name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Sets the calories the Food will give when somebody bits it.
	 * @param calories The new amount of calories.
	 */
	public void setCalories(int calories) {
		this.calories = calories;
	}
	
	public int getRemainingBites(){
		return remainingBites;
	}


}
